from flask_restful import Resource

from restful.api__.session import login_required_current_user_generate, \
    uid_required_target_user_generate
from restful.model.query import QueryMultipleInstances
from restful.model.tables import  Follow
from restful.response import ResponseSuccess

#uid关注了谁
class UserAllFollowing(Resource):
    @login_required_current_user_generate
    @uid_required_target_user_generate
    def get(self,target_user,current_user):
        likes = QueryMultipleInstances(Follow, {'uid': target_user.id})
        return ResponseSuccess(data=[{
                'uid':i.uid1,
                'time':i.time
            } for i in likes]
        )